package com.shuoyue.ycgk.ui.main.adapter;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseViewHolder;
import com.shuoyue.ycgk.R;
import com.shuoyue.ycgk.base.baseadapter.AppBaseQuickAdapter;
import com.shuoyue.ycgk.entity.Mok;

import java.util.List;

public class HomeMokRecAdapter extends AppBaseQuickAdapter<Mok> {
    public HomeMokRecAdapter(@Nullable List<Mok> data) {
        super(R.layout.item_home_mok, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, Mok item) {
        helper.addOnClickListener(R.id.report);
        helper.setText(R.id.title, item.getTitle());
        helper.setText(R.id.time, item.getStartTime());
        helper.setText(R.id.report, item.getMemberStatus());
//        helper.setText(R.id.statue, item.getMockStatus());

        if (item.getMockStatusInt() == 0 && item.getMemberStatusInt() == 0) {
            helper.setBackgroundRes(R.id.lay_all, R.mipmap.mockbg01);
        } else if (item.getMockStatusInt() == 0 && item.getMemberStatusInt() == 1) {
            helper.setBackgroundRes(R.id.lay_all, R.mipmap.mockbg02);
        } else if (item.getMockStatusInt() == 1 && item.getMemberStatusInt() == 0) {
            helper.setBackgroundRes(R.id.lay_all, R.mipmap.mockbg04);
        } else if (item.getMockStatusInt() == 1 && item.getMemberStatusInt() == 1) {
            helper.setBackgroundRes(R.id.lay_all, R.mipmap.mockbg04);
        } else {
            helper.setBackgroundRes(R.id.lay_all, R.mipmap.mockbg03);
        }

        if (item.getMockStatusInt() == 0 && item.getMemberStatusInt() == 0) {
            helper.setImageResource(R.id.statue, R.mipmap.examstatebg01);
        } else if (item.getMockStatusInt() == 0 && item.getMemberStatusInt() == 1) {
            helper.setImageResource(R.id.statue, R.mipmap.examstatebg02);
        } else if (item.getMockStatusInt() == 1) {
            helper.setImageResource(R.id.statue, R.mipmap.examstatebg03);
        } else if (item.getMockStatusInt() == 2) {
            helper.setImageResource(R.id.statue, R.mipmap.examstatebg04);
        } else {
            helper.setImageResource(R.id.statue, R.mipmap.examstatebg04);
        }

//        switch (item.getMockStatusInt()) {
//            case 0:
//                helper.setBackgroundColor(R.id.lay_all, Color.parseColor("#60FF728D"));
//                break;
//            case 1:
//                helper.setBackgroundColor(R.id.lay_all, Color.parseColor("#60FDCA71"));
//                break;
//            case 2:
//                helper.setBackgroundColor(R.id.lay_all, Color.parseColor("#60999999"));
//                break;
//        }
    }
}
